package com.itheima.controller;

import com.itheima.pojo.Province;
import com.itheima.pojo.Result;
import com.itheima.service.ProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/province")
public class ProvinceController {

    @Autowired
    private ProvinceService provinceService;

    /**
     * 查询全部省份
     */
    @GetMapping
    public Result<List<Province>> list(){
        return Result.success(provinceService.list());
    }

}
